package com.Liux.blog.controller;

import com.Liux.blog.entity.Article;
import com.Liux.blog.entity.User;
import com.Liux.blog.service.ArticleService;
import com.Liux.blog.service.UserService;
import com.Liux.blog.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
@RequestMapping("/article")
public class ArticleController {

    @Autowired
    private ArticleService articleService;

    @Autowired
    private UserService userService;
    @PostMapping("/add")
    public ResultVo addArticle(Article article){
        return articleService.createArticle(article);

    }

    @PostMapping("/addUser")
    public ResultVo addUser(User user){
        ResultVo resultVo = userService.addUser(user);
        return resultVo;

    }


}
